package com.util;

import com.controller.UserController;
import com.javabean.User;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class UserTest {

    @Test
    public void t1(){
        ClassPathXmlApplicationContext applicationContext=new ClassPathXmlApplicationContext("spring-context.xml");
        User bean = applicationContext.getBean(User.class);
        System.out.println(bean);
    }

    //直接创建调用
    @Test
    public void t2(){
        UserController userController=new UserController();
        userController.loginUrl();
    }
    //spring容器获取使用
    @Test
    public void t3(){
        ClassPathXmlApplicationContext applicationContext=new ClassPathXmlApplicationContext("spring-context.xml");
        UserController bean = (UserController) applicationContext.getBean("userController");
        bean.loginUrl();
    }



}
